#ifndef __MYSYSTEM_H
#define __MYSYSTEM_H

#include "main.h"

extern uint16_t currentbuf[adc_max];
extern float Theta_Accumulate;
extern float actual_postion;
typedef enum {
	START,
    FORWARD,
    DECELERATE,
	REVERSE_ACCEL,
	REVERSE_DECEL,
} MotorState_t;

extern MotorState_t motor_state;
extern bool soft_trigger_flag;
extern uint8_t temp_motor_dir;
//extern uint32_t accelerate_count;
extern int32_t accelerate_count;
extern bool accelerate_flag;

void TaskManager(void);
void Speed_PI_Task(void);
void Position_Speed_PI_Task(void);
void LED_Task(void);
void SpeedControl_Task(void);
void SpeedMonitor_Task(void);
void Motor_Start_Task(void);
void Motor_Stop_Task(void);
void ModBus_Task(void);
void UpdateSystem_Log_Task(void);
void MotorStateDetect(void);
#endif

